#ifndef __ming_fyp_app_DXUTApp_h__
#define __ming_fyp_app_DXUTApp_h__

//------------------------------------------------------------------------------
// header includes
#include <d3d9.h>
#include "DXUT.h"

//------------------------------------------------------------------------------
namespace ming
{
namespace fyp
{
namespace app
{
	class IDxApp;

	//--------------------------------------------------------------------------
	class TDXUTWrapper
	{
	public:
		
		//------------------------------
		// external operations
		static void Run(IDxApp *app);
		
	private:
		//------------------------------
		// #cstor & #dstor
		TDXUTWrapper();
		~TDXUTWrapper();
		
		//------------------------------
		// internal attributes
		static IDxApp *mApp;

		static bool CALLBACK ModifyDeviceSettings(
			DXUTDeviceSettings* pDeviceSettings,
			void* pUserContext);

		static bool CALLBACK OnCheckDeviceAcceptable(
			D3DCAPS9* pCaps,
			D3DFORMAT AdapterFormat,
			D3DFORMAT BackBufferFormat,
			bool bWindowed,
			void* pUserContext);

		static HRESULT CALLBACK OnDeviceCreated(
			IDirect3DDevice9* pd3dDevice,
			const D3DSURFACE_DESC* pBackBufferSurfaceDesc,
			void* pUserContext);

		static HRESULT CALLBACK OnDeviceReset(
			IDirect3DDevice9* pd3dDevice,
			const D3DSURFACE_DESC* pBackBufferSurfaceDesc,
			void* pUserContext);

		static void CALLBACK OnFrameRender(
			IDirect3DDevice9* pd3dDevice,
			double fTime,
			float fElapsedTime,
			void* pUserContext);

		static void CALLBACK OnDeviceLost(
			void *pUserContext);

		static void CALLBACK OnDeviceDestroyed(
			void *pUserContext);

		static void CALLBACK OnMouseEvent(
			bool bLeftButtonDown,
			bool bRightButtonDown,
			bool bMiddleButtonDown,
			bool bSideButton1Down,
			bool bSideButton2Down,
			int nMouseWheelDelta,
			int xPos,
			int yPos,
			void* pUserContext);

		static void CALLBACK OnKeyboardEvent(
			UINT nChar,
			bool bKeyDown,
			bool bAltDown,
			void* pUserContext);

		static LRESULT CALLBACK OnWindowEvent(
			HWND hWnd,
			UINT uMsg,
			WPARAM wParam,
			LPARAM lParam,
			bool* pbNoFurtherProcessing,
			void* pUserContext);

		//------------------------------
		// internal operations
	};
	
	//--------------------------------------------------------------------------
}
}
}


#endif	//__ming_fyp_app_DXUTApp_h__